#pragma once
#include "f2c.h"

using namespace System;

namespace SmartMathLibrary
{
  namespace InternalRoutines
  {
    public delegate doublereal PrincipalAxisHelperFunction(doublereal *,
      integer*);

    public ref class PrincipalAxisOptimizerProvider
    {
      public:
        static doublereal PrincipalAxisMethod(doublereal *t0, doublereal
          *machep, doublereal *h0, integer *n, integer *prin, doublereal *x,
          PrincipalAxisHelperFunction ^ f, doublereal *fmin);
      private:
        static integer pow_ii(integer *ap, integer *bp);
        static int minfit_(integer *m, integer *n, doublereal *machep,
          doublereal *tol, doublereal *ab, doublereal *q);
        static int min_(integer *n, integer *j, integer *nits, doublereal *d2,
          doublereal *x1, doublereal *f1, logical *fk,
          PrincipalAxisHelperFunction ^ f, doublereal *x, doublereal *t,
          doublereal *machep, doublereal *h__);
        static doublereal flin_(integer *n, integer *j, doublereal *l,
          PrincipalAxisHelperFunction ^ f, doublereal *x, integer *nf);
        static int sort_(integer *m, integer *n, doublereal *d__, doublereal *v)
          ;
        static int quad_(integer *n, PrincipalAxisHelperFunction ^ f,
          doublereal *x, doublereal *t, doublereal *machep, doublereal *h__);
        static doublereal random_(integer *naught);
        static double d_lg10(doublereal *x);
    };
  }
}
